This section looks at different tools and libraries for working with OpenGL in an X Window System environment, moving from easy-to-use toolkits and libraries with less control to the Xlib library, which is more primitive but offers more control. Most application developers usually write at a higher level than Xlib, but you may find it helpful to understand the basic facts about the lower levels discussed in this guide.
Note that the different tools are not mutually exclusive: You may design most of the interface with one of the higher-level tools, then use Xlib to fine-tune a specific aspect or add something that's otherwise unavailable. Figure 1-1 illustrates the layering:
Figure 1-1 : How X, OpenGL, and Toolkits are Layered
Note: If you write an application using IRIS Viewkit, OpenInventor, or RapidApp(TM), the graphical user interface will be visually consistent with the Indigo Magic desktop.
To speed the development cycle, RapidApp is integrated with a number of the Developer Magic(TM)tools. This allows developers to quickly design, compile, and test object-oriented applications.
RapidApp also provides easy access to Silicon Graphics specific widgets and components. For instance, you can add an OpenGL widget to a program without having to know much about the underlying details of integrating OpenGL and X.
For more information, see the Developer Magic: RapidApp User's Guide, also available online through IRIS InSight.
Open Inventor provides prepackaged tools for viewing, manipulating, and animating 3D objects. It also provides widgets for easy interaction with X and Xt, and a full event-handling system.
In most cases, you use Open Inventor, not the lower-level OpenGL library for rendering from Open Inventor. However, the Open Inventor library provides several widgets for use with X and OpenGL (in subclasses of the SoXtGLWidget class) that you can use if OpenGL rendering is desired. For instance, the SoXtRenderArea widget and its viewer subclasses can all perform OpenGL rendering. SoXtGLWidget is, in turn, a subclass of SoXtComponent, the general Open Inventor class for widgets that perform 3D editing.
Components provide functions to show and hide the associated widgets, set various parameters (such as title and size of the windows), and use callbacks to send data to the calling application. The viewer components based on SoXtRenderArea handle many subsidiary tasks related to viewing 3D objects. Other components handle anything from editing materials and lights in a 3D scene, to copying and pasting 3D objects.
Note that if you're using libInventorXt, you only need to link with libInventorXt (it automatically "exports" all of the routines in libInventor, so you never need to use -lInventorXt -lInventor, you only need -lInventorXt).
For detailed information on Open Inventor, see The Inventor Mentor: Programming Object-Oriented 3D Graphics with Open Inventor,(TM) Release 2, published by Addison-Wesley and available online through IRIS InSight.
When you use Viewkit in conjunction with OpenGL, it provides drawing areas that OpenGL can render to.
For more information, see the IRIS ViewKit Programmer's Guide, available online through IRIS InSight.